package com.jinpin.storage.controller;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.jinpin.core.dto.ArticleDto;
import com.jinpin.storage.entity.Article;
import com.jinpin.storage.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ArticleController {


    @Autowired
    private ArticleService articleService;

    @PutMapping("/updateArticle")
    public String updateArticle(@RequestBody ArticleDto article){
        Article article1 = BeanUtil.copyProperties(article, Article.class);
        UpdateWrapper<Article> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("id",1);
        boolean b = articleService.update(article1,updateWrapper);
        int i = 1/0;
        return "更新物料库存成功";
    }




}
